<template>
  <div class="home">
    <el-card class="welcome-card">
      <template #header>
        <div class="card-header">
          <span>欢迎来到小猪商城</span>
        </div>
      </template>
      <div class="content">
        <h2>🐷 小猪商城 - 您的购物天堂</h2>
        <p>这是一个基于 Vue3 + Spring Boot 的现代化电商平台，提供完整的购物体验：</p>
        <ul>
          <li>🛍️ 丰富的商品展示</li>
          <li>🔍 智能搜索和分类筛选</li>
          <li>🛒 便捷的购物车管理</li>
          <li>👤 完善的用户系统</li>
          <li>📱 响应式设计，支持多端访问</li>
          <li>⚡ 现代化的技术栈</li>
        </ul>
        <div class="action-buttons">
          <el-button type="primary" size="large" @click="goToProducts">
            <el-icon><Shopping /></el-icon>
            开始购物
          </el-button>
          <el-button type="success" size="large" @click="goToAbout">
            了解更多
          </el-button>
        </div>
      </div>
    </el-card>

    <!-- 功能特色 -->
    <el-row :gutter="20" class="features">
      <el-col :span="8">
        <el-card class="feature-card">
          <div class="feature-icon">🛍️</div>
          <h3>商品管理</h3>
          <p>丰富的商品展示，支持分类浏览和智能搜索</p>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card class="feature-card">
          <div class="feature-icon">🛒</div>
          <h3>购物车</h3>
          <p>便捷的购物车管理，支持数量修改和批量操作</p>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card class="feature-card">
          <div class="feature-icon">👤</div>
          <h3>用户系统</h3>
          <p>完善的用户注册、登录和个人信息管理</p>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Shopping } from '@element-plus/icons-vue'

const router = useRouter()

const goToProducts = () => {
  router.push('/products')
}

const goToAbout = () => {
  router.push('/about')
}
</script>

<style scoped lang="scss">
.home {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content {
  text-align: center;
  
  h2 {
    color: #409eff;
    margin-bottom: 20px;
  }
  
  p {
    font-size: 16px;
    margin-bottom: 15px;
  }
  
  ul {
    text-align: left;
    max-width: 400px;
    margin: 0 auto 20px;
    
    li {
      margin-bottom: 8px;
      color: #666;
    }
  }
  
  .action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
  }
}

.features {
  margin-top: 30px;
}

.feature-card {
  text-align: center;
  padding: 20px;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.feature-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 18px;
}

.feature-card p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .features .el-col {
    margin-bottom: 20px;
  }
}
</style> 